install: Add switch to skip installation if packages exist in cache#1981
install: Add switch to skip installation if packages exist in cache#1981autoantwort wants to merge 1 commit intomicrosoft:mainfrom
Conversation
bffeb95 to
4fabd3a
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new --skip-install-if-cached switch to vcpkg install / vcpkg x-set-installed intended to avoid the (potentially expensive) “restore/extract into packages/installed” step when all required binaries are already present in configured binary cache providers.
Changes:
- Add
--skip-install-if-cachedswitch wiring toinstallandset-installed. - Implement an early-exit path in
command_set_installed_and_exit_ex()based onBinaryCache::precheck(...). - Add localized help text and a new status message for the “skipped because cached” outcome.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/vcpkg/commands.set-installed.cpp |
Implements the skip-if-cached early-exit behavior in the manifest/set-installed execution flow. |
src/vcpkg/commands.install.cpp |
Exposes the new switch on install and passes it into the manifest-mode implementation path. |
include/vcpkg/commands.set-installed.h |
Extends the command_set_installed_and_exit_ex signature to carry the new flag. |
include/vcpkg/base/contractual-constants.h |
Adds the skip-install-if-cached switch literal. |
include/vcpkg/base/message-data.inc.h |
Declares new localized messages for the switch help and the “skipped” output. |
locales/messages.json |
Adds English strings for the new help text and “packages cached” message. |
4fabd3a to
5099a76
Compare
5099a76 to
e98cf4a
Compare
At work we run `install` for every triplet we use and for every commit in the last two years that changed the vcpkg.json file/vcpkg submodule. We do this so that if we update our compiler/Visual Studio and a developer switches to an older support branch, they don't have to wait until all our vcpkg dependencies are build. The problem is now that this nightly job already needs 6 hours since it restores a for of packages from the cache, which is completely unnecessary if all packages are already in the cache.
e98cf4a to
4c28efb
Compare
(@BillyONeal also paraphrasing @AugP and @vicroms) Are you saying it takes 6 hours just to restore from cache when there are cache hits? We broadly think the scenario can make sense but we object to it being part of the "install" command when the result might not actually be that things are installed. (@BillyONeal speaking personally) Conceptually this is very similar to the "ci" command except instead of the input being |
At work we run
installfor every triplet we use and for every commit in the last two years that changed the vcpkg.json file/vcpkg submodule. We do this so that if we update our compiler/Visual Studio and a developer switches to an older support branch, they don't have to wait until all our vcpkg dependencies are build. The problem is now that this nightly job already needs 6 hours since it restores a for of packages from the cache, which is completely unnecessary if all packages are already in the cache.